package com.sali.a_pre_knowledge.lesson_lsp.lession_02;

import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @description:
 * @date: 2022/11/5 11:50.
 * @version: 1.0
 */
@Slf4j
public class CreditCard extends AbstractBankCard {


    public CreditCard(String cardNo, String cardDate) {
        super(cardNo, cardDate);
    }

    @Override
    public boolean rule(BigDecimal amount) {
        return amount.compareTo(new BigDecimal(1000)) >= 0;
    }

    /**
     * description: 贷款
     **/
    @Override
    public String handleGet(String orderId, BigDecimal amount) {
        if (rule(amount)) {
            log.info("信用卡贷款金额限额{1000}元，单号是：{},金额是：{}", orderId, amount);
            return "0001";
        }
        log.info("信用卡贷款成功，单号是：{},金额是：{}", orderId, amount);
        return "123456";
    }

    /**
     * description: 还款
     **/
    @Override
    public String handlePut(String orderId, BigDecimal amount) {
        log.info("生成还款单成功，单号是：{},金额是：{}", orderId, amount);
        return "123456";
    }

}
